<{extend name="Public:public0" /}>

<{block name="title"}>基于webpack 环境配置<{/block}>

<{block name="sidebar"}><{include file="Public:sidebar-vuecli" /}><{/block}>

<{block name="content"}> 
<div class="content guide with-sidebar components-guide">
	
<h1>基于webpack 环境配置</h1>	
<h2 id="运行服务器">
	<a href="#运行服务器" class="headerlink" title="运行服务器" data-scroll="">运行服务器</a>
</h2>

<h3 id="运行服务器0">
	<a href="#运行服务器0" class="headerlink" title="运行服务器0" data-scroll="">运行服务器 cmd</a>
</h3>
<code class="prettyprint linenums">#&nbsp;进入项目目录<br/>&gt;&nbsp;e:<br/>E:\&gt;&nbsp;cd&nbsp;0_codeWork\0_Myjoin<br/>E:\0_codeWork\0_Myjoin&gt;&nbsp;npm&nbsp;run&nbsp;dev<br/>下面自动打包...<br/>Your&nbsp;application&nbsp;is&nbsp;running&nbsp;here:&nbsp;http://localhost:8080
</code>
<br>

<h3 id="cmd其他操作命令">
	<a href="#cmd其他操作命令" class="headerlink" title="cmd其他操作命令" data-scroll="">cmd其他操作命令</a>
</h3>
<code class="prettyprint linenums">ctr+c&nbsp;&nbsp;//&nbsp;终止运行<br/>cls&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;清屏
</code>
<br><br><br>


<h2 id="代码初始化">
	<a href="#代码初始化" class="headerlink" title="代码初始化" data-scroll="">代码初始化</a>
</h2>

<h3 id="viewport">
	<a href="#viewport" class="headerlink" title="viewport" data-scroll="">viewport index.html</a>
</h3>
<code class="prettyprint linenums">//&nbsp;0_Myjoin&nbsp;/&nbsp;index.html<br/>&lt;!DOCTYPE&nbsp;html&gt;<br/>&lt;html&gt;<br/>&nbsp;&nbsp;&lt;head&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;meta&nbsp;charset=&quot;utf-8&quot;&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;meta&nbsp;name=&quot;viewport&quot;&nbsp;content=&quot;width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no&quot;&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;myjoin&lt;/title&gt;<br/>&nbsp;&nbsp;&lt;/head&gt;<br/>&nbsp;&nbsp;&lt;body&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;div&nbsp;id=&quot;app&quot;&gt;&lt;/div&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;!--&nbsp;built&nbsp;files&nbsp;will&nbsp;be&nbsp;auto&nbsp;injected&nbsp;--&gt;<br/>&nbsp;&nbsp;&lt;/body&gt;<br/>&lt;/html&gt;
</code>
<br/>

<h3 id="resetcss">
	<a href="#resetcss" class="headerlink" title="resetcss" data-scroll="">reset.css 样式初始化</a>
</h3>
<code class="prettyprint linenums">//&nbsp;main.js<br/>import&nbsp;'styles/border.css'
</code>
<br/>

<h3 id="stylus_install">
	<a href="#stylus_install" class="headerlink" title="stylus_install" data-scroll="">安装 stylus</a>
</h3>
<code class="prettyprint linenums">#&nbsp;进入项目目录<br/>&gt;&nbsp;e:<br/>E:\&gt;&nbsp;cd&nbsp;0_codeWork\0_Myjoin<br/>E:\0_codeWork\0_Myjoin&gt;&nbsp;npm&nbsp;install&nbsp;stylus&nbsp;--save<br/><br/>E:\0_codeWork\0_Myjoin&gt;&nbsp;npm&nbsp;install&nbsp;stylus-loader&nbsp;--save
</code>
<br>

<h3 id="fastclick">
	<a href="#fastclick" class="headerlink" title="fastclick" data-scroll="">fastclick.js 解决点击延时</a>
</h3>
<div>1. npm安装 fastclick</div>
<code class="prettyprint linenums">#&nbsp;进入项目目录<br/>&gt;&nbsp;e:<br/>E:\&gt;&nbsp;cd&nbsp;0_codeWork\0_Myjoin<br/>E:\0_codeWork\0_Myjoin&gt;&nbsp;npm&nbsp;install&nbsp;fastclick&nbsp;--save
</code>

<div>2. 引入项目</div>
<code class="prettyprint linenums">//&nbsp;main.js<br/>import&nbsp;fastclick&nbsp;from&nbsp;'fastclick'<br/>fastclick.attach(document.body)
</code>
<br/>

<h3 id="bordercss">
	<a href="#bordercss" class="headerlink" title="bordercss" data-scroll="">border.css 1像素边框</a>
</h3>
<code class="prettyprint linenums">//&nbsp;main.js<br/>import&nbsp;'styles/reset.css'
</code>
<br/>

<h3 id="iconfont">
	<a href="#iconfont" class="headerlink" title="iconfont" data-scroll="">iconfont</a>
</h3>
<div>http://www.iconfont.cn =&gt; 图标管理 =&gt; 我的项目 =&gt; 新建项目</div>
<br><br><br>



<h2 id="安装">
	<a href="#安装" class="headerlink" title="安装" data-scroll="">安装</a>
</h2>	

<h3 id="node">
	<a href="#node" class="headerlink" title="node" data-scroll="">安装node.js LTS版本 cmd</a>
</h3>
<code class="prettyprint linenums">&gt;&nbsp;node&nbsp;-v<br/>v10.13.0<br/>&gt;&nbsp;npm&nbsp;-v<br/>6.4.1
</code>
<br>

<h3 id="vuecli">
	<a href="#vuecli" class="headerlink" title="vuecli" data-scroll="">安装vue-cil 全局安装一次 cmd</a>
</h3>
<code class="prettyprint linenums">#&nbsp;全局安装&nbsp;vue-cli<br/>&gt;&nbsp;npm&nbsp;install&nbsp;--global&nbsp;vue-cli
</code>
<br>

<h3 id="webpack">
	<a href="#webpack" class="headerlink" title="webpack" data-scroll="">创建 webpack模板的项目 cmd</a>
</h3>
<code class="prettyprint linenums">#&nbsp;切换到&nbsp;需要安装的文件夹<br/>&gt;&nbsp;e:<br/>E:\&gt;&nbsp;cd&nbsp;0_codeWork<br/>E:\0_codeWork&gt;&nbsp;vue&nbsp;init&nbsp;webpack&nbsp;0_Myjoin&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;0_Myjoin为需要创建的文件夹<br/>?&nbsp;Target&nbsp;directory&nbsp;exists.&nbsp;Continue?&nbsp;(Y/n)&nbsp;Y回车<br/>?&nbsp;Project&nbsp;name&nbsp;(0_Myjoin)&nbsp;myjoin回车&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;项目文件名&nbsp;必须小写<br/>?&nbsp;Project&nbsp;description&nbsp;myjoin&nbsp;taijiao回车&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;项目描述<br/>?&nbsp;Author&nbsp;vanzyi&nbsp;回车&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;作者<br/>&gt;&nbsp;Runtime&nbsp;+&nbsp;Compiler回车&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;编译方式&nbsp;第1种&nbsp;standalone<br/>?Install&nbsp;vue-router?&nbsp;Y&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;安装&nbsp;vue路由<br/>?Use&nbsp;ESLint&nbsp;to&nbsp;lint&nbsp;your&nbsp;code?&nbsp;Y&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;代码&nbsp;ESLint&nbsp;检查规范<br/>?Pick&nbsp;an&nbsp;ESLint&nbsp;preset&nbsp;Standard&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;代码&nbsp;ESLint&nbsp;检查规范<br/>?Set&nbsp;up&nbsp;unit&nbsp;tests&nbsp;n&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;单元化测试<br/>?Setup&nbsp;e2e&nbsp;tests...&nbsp;n&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;端到端测试<br/>?Should&nbsp;we&nbsp;run&nbsp;'npm&nbsp;install'...&nbsp;Yes,&nbsp;use&nbsp;NPM&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;包管理方式<br/>下面自动安装...
</code>
<br><br>

<h3 id="cnpm">
	<a href="#cnpm" class="headerlink" title="cnpm" data-scroll="">使用npm淘宝镜像</a>
</h3>

<b>这是一个完整 <code>npmjs.org</code> 镜像，你可以用此代替官方版本(只读)，同步频率目前为 <strong>10分钟</strong> 一次以保证尽量与官方服务同步。</b>
<ul>
<li>当前 <a href="//registry.npm.taobao.org">registry.npm.taobao.org</a> 是从 <a href="//r.cnpmjs.org">r.cnpmjs.org</a> 进行全量同步的.</li>
<li>当前 <a href="/">npm.taobao.org</a> 运行版本是: <a href="http://cnpmjs.org">cnpmjs.org</a>@<span id="app-version"></span></li>
<li>本系统运行在 <a href="https://nodejs.org">Node.js</a>@<span id="node-version"></span> 上.</li>
<li>开源镜像: <a href="http://npm.taobao.org/mirrors">http://npm.taobao.org/mirrors</a></li>
<li>Node.js 镜像: <a href="http://npm.taobao.org/mirrors/node">http://npm.taobao.org/mirrors/node</a></li>
<li>alinode 镜像: <a href="http://npm.taobao.org/mirrors/alinode">http://npm.taobao.org/mirrors/alinode</a></li>
<li>phantomjs 镜像: <a href="http://npm.taobao.org/mirrors/phantomjs">http://npm.taobao.org/mirrors/phantomjs</a></li>
<li>ChromeDriver 镜像: <a href="http://npm.taobao.org/mirrors/chromedriver">http://npm.taobao.org/mirrors/chromedriver</a></li>
<li>OperaDriver 镜像: <a href="http://npm.taobao.org/mirrors/operadriver">http://npm.taobao.org/mirrors/operadriver</a></li>
<li>Selenium 镜像: <a href="http://npm.taobao.org/mirrors/selenium">http://npm.taobao.org/mirrors/selenium</a></li>
<li>Node.js 文档镜像: <a href="http://npm.taobao.org/mirrors/node/latest/docs/api/index.html">http://npm.taobao.org/mirrors/node/latest/docs/api/index.html</a></li>
<li>NPM 镜像: <a href="https://npm.taobao.org/mirrors/npm/">https://npm.taobao.org/mirrors/npm/</a></li>
<li>electron 镜像: <a href="https://npm.taobao.org/mirrors/electron/">https://npm.taobao.org/mirrors/electron/</a></li>
<li>node-inspector 镜像: <a href="https://npm.taobao.org/mirrors/node-inspector/">https://npm.taobao.org/mirrors/node-inspector/</a></li>
</ul>
<div class="ant-table">
<table class="downloads">
  <tbody>
    <tr>
      <td class="count" id="total-packages"></td><td>个模块</td>
      <td class="count" id="total-versions"></td><td>个模块版本</td>
      <td class="count" id="total-deletes"></td><td>次删除</td>
    </tr>
    <tr>
      <td class="count"></td><td> 次本日下载</td>
      <td class="count"></td><td> 次本周下载</td>
      <td class="count"></td><td> 次本月下载</td>
    </tr>
    <tr>
      <td class="count"></td><td> 次昨日下载</td>
      <td class="count"></td><td> 次上周下载</td>
      <td class="count"></td><td> 次上月下载</td>
    </tr>
  </tbody>
</table>
</div>

<h4>Version Badge</h4>
<p>Default style is <code>flat-square</code>.</p>
<p>Badge URL: <code>https://npm.taobao.org/badge/v/cnpmjs.org.svg</code> <img src="https://npm.taobao.org/badge/v/cnpmjs.org.svg" alt="cnpmjs.org-badge"></p>
<ul>
<li><code>&lt;0.1.0 &amp; &gt;=0.0.0</code>: <img src="https://img.shields.io/badge/cnpm-0.0.1-red.svg?style=flat-square" alt="red-badge"></li>
<li><code>&lt;1.0.0 &amp; &gt;=0.1.0</code>: <img src="https://img.shields.io/badge/cnpm-0.1.0-green.svg?style=flat-square" alt="red-badge"></li>
<li><code>&gt;=1.0.0</code>: <img src="https://img.shields.io/badge/cnpm-1.0.0-blue.svg?style=flat-square" alt="red-badge"></li>
</ul>

<h4>使用说明</h4>
<p>你可以使用我们定制的 <a href="https://github.com/cnpm/cnpm">cnpm</a> (gzip 压缩支持) 命令行工具代替默认的 <code>npm</code>:</p>
<code class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><span class="pln">$&nbsp;npm&nbsp;install&nbsp;</span><span class="pun">-</span><span class="pln">g&nbsp;cnpm&nbsp;</span><span class="pun">--</span><span class="pln">registry</span><span class="pun">=</span><span class="pln">https</span><span class="pun">:</span><span class="com">//registry.npm.taobao.org</span></li></ol></code>

<p>或者你直接通过添加 <code>npm</code> 参数 <code>alias</code> 一个新命令:</p>
<code class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><span class="kwd">alias</span><span class="pln">&nbsp;cnpm</span><span class="pun">=</span><span class="str">"npm&nbsp;--registry=https://registry.npm.taobao.org&nbsp;\</span></li><li class="L1"><span class="str">--cache=$HOME/.npm/.cache/cnpm&nbsp;\</span></li><li class="L2"><span class="str">--disturl=https://npm.taobao.org/dist&nbsp;\</span></li><li class="L3"><span class="str">--userconfig=$HOME/.cnpmrc"</span></li><li class="L4"><span class="pln">&nbsp;</span></li><li class="L5"><span class="com">#&nbsp;Or&nbsp;alias&nbsp;it&nbsp;in&nbsp;.bashrc&nbsp;or&nbsp;.zshrc</span></li><li class="L6"><span class="pln">$&nbsp;echo&nbsp;</span><span class="str">'\n#alias&nbsp;for&nbsp;cnpm\nalias&nbsp;cnpm="npm&nbsp;--registry=https://registry.npm.taobao.org&nbsp;\</span></li><li class="L7"><span class="str">&nbsp;&nbsp;--cache=$HOME/.npm/.cache/cnpm&nbsp;\</span></li><li class="L8"><span class="str">&nbsp;&nbsp;--disturl=https://npm.taobao.org/dist&nbsp;\</span></li><li class="L9"><span class="str">&nbsp;&nbsp;--userconfig=$HOME/.cnpmrc"'</span><span class="pln">&nbsp;</span><span class="pun">&gt;&gt;</span><span class="pln">&nbsp;</span><span class="pun">~</span><span class="str">/.zshrc&nbsp;&amp;&amp;&nbsp;source&nbsp;~/</span><span class="pun">.</span><span class="pln">zshrc</span></li></ol></code>

<h6>安装模块</h6>
<p>从 <a href="//registry.npm.taobao.org">registry.npm.taobao.org</a> 安装所有模块.当安装的时候发现安装的模块还没有同步过来, 淘宝 NPM 会自动在后台进行同步,并且会让你从官方 NPM <a href="//registry.npmjs.org">registry.npmjs.org</a> 进行安装.下次你再安装这个模块的时候, 就会直接从 淘宝 NPM 安装了.</p>
<code class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><span class="pln">$&nbsp;cnpm&nbsp;install&nbsp;</span><span class="pun">[</span><span class="pln">name</span><span class="pun">]</span></li></ol></code>

<h6>同步模块</h6>
<p>直接通过 <code>sync</code> 命令马上同步一个模块, 只有 <code>cnpm</code> 命令行才有此功能:</p>
<code class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><span class="pln">$&nbsp;cnpm&nbsp;sync&nbsp;connect</span></li></ol></code>

<p>当然, 你可以直接通过 web 方式来同步: <a href="/sync/connect">/sync/connect</a></p>
<code class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><span class="pln">$&nbsp;open&nbsp;https</span><span class="pun">:</span><span class="com">//npm.taobao.org/sync/connect</span></li></ol></code>

<h6>其他命令</h6>
<p>支持 <code>npm</code> 除了 <code>publish</code> 之外的所有命令, 如:</p>
<code class="prettyprint linenums prettyprinted" style=""><ol class="linenums"><li class="L0"><span class="pln">$&nbsp;cnpm&nbsp;info&nbsp;connect</span></li></ol></code>


</div>	<!-- content -->

<{/block}>
